/*
 * #%L
 * java model
 * %%
 * Copyright (C) 2009 - 2011 prefabware.com Stefan Isele
 * %%
 * All Rights Reserved.
 * This program is dual-licensed under the GNU General Public license
 * or a commercial license.
 * You may select to use one or the other of these licenses.
 * To obtain a commercial license please contact Stefan Isele at www.stefan-isele.de
 * Any modifications to this file must keep this entire header intact.
 * Redistribution, except as permitted by the selected license, is prohibited.
 * #L%
 */
package com.prefabware.jmodel.expression;

import com.prefabware.jmodel.JClass;
import com.prefabware.jmodel.JConstructor;
import com.prefabware.jmodel.code.JCodeOptions;


public class JConstructorInvocation extends JMethodInvocation {

	

	public JConstructorInvocation(JConstructor constructor) {
		// the target of a constructor call is allways its jclass
		super(constructor.getJClass(), constructor); 
	}

	@Override
	public String asCode(JCodeOptions options) {
		String code = String.format("new %s(%s)", this.getTarget().asCode(options),this.argumentList(options));
		return code;
	}

	@Override
	public JClass getTarget() {
		return (JClass) super.getTarget();
	}

	
}
